<template>
  <div class="app">
    <router-view></router-view>
  </div>
</template>

<script setup lang="ts">
import { onBeforeMount } from 'vue'

onBeforeMount(() => {
  initDark()
})

// 初始化暗黑模式
const initDark = (): void => {
  const htmlEl = document.documentElement as HTMLElement
  const darkValue = localStorage.getItem('dark')
  if (darkValue === 'dark') {
    htmlEl.classList.add('dark')
  }
}
</script>
